﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using XMK.Tadong.Biz;

namespace XMK.Tadong.Web.TJ
{
    public partial class TJ_WT : System.Web.UI.Page
    {
        YQCJDBLL bll = new YQCJDBLL();
        private void Page_Load(object sender, System.EventArgs e)
        {
            
            if (!IsPostBack)
            {
                string strSql = "select distinct tjnd  from aw02 order by tjnd desc";
                DataTable dtNian = bll.QueryData(strSql);
                ddlNian.Items.Clear();
                foreach (DataRow drow in dtNian.Rows)
                {
                    string strNian = drow[0].ToString();
                    ddlNian.Items.Add(strNian);
                }
            }
            BindGrid();
        }

        private void ddlNian_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            BindGrid();
        }

        private void BindGrid()
        {
            string strNian = ddlNian.SelectedValue;
            string strSql = "select tjnd as \"年度\",gq \"统计单元\",gzff　\"方法\",sum(cds) as \"测点数\" from aw02  where tjnd='" + strNian + "' group by tjnd,gq,gzff";
            DataTable dt = bll.QueryData(strSql);
            this.DataGrid1.DataSource = dt;
            DataGrid1.DataBind();

        }

    }
}